package com.gary.service;

import com.gary.bean.BackendUserPojo;
import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;

/**
 * 变量处理方法  反射执行
 *
 * @author Homan Liang
 * @date 2019/11/7
 */
public class DataPermissionVariableGetService {
    private Logger logger = LoggerFactory.getLogger(DataPermissionVariableGetService.class);

    /**
     * 获取空字符串
     *
     * @param backendUserPojo 当前登录用户信息
     * @return 空字符串
     */
    public String getEmptyString(BackendUserPojo backendUserPojo) {
        return "";
    }

    /**
     * 获取 null 字符串
     *
     * @param backendUserPojo 当前登录用户信息
     * @return null 字符串
     */
    public String getNullValue(BackendUserPojo backendUserPojo) {
        return " null ";
    }

    /**
     * 获取 not null 字符串
     *
     * @param backendUserPojo 当前登录用户信息
     * @return not null 字符串
     */
    public String getNotNullValue(BackendUserPojo backendUserPojo) {
        return " not null ";
    }

    /**
     * 获取当前登录用户Id
     *
     * @param backendUserPojo 当前登录用户信息
     * @return 当前登录用户Id
     */
    public String getCurrentUser(BackendUserPojo backendUserPojo) {
        return "";
    }

    /**
     * 获取当前登录用户的权限部门
     *
     * @param backendUserPojo 当前登录用户信息
     * @return 当前登录用户的权限部门
     */
    public String getUserDept(BackendUserPojo backendUserPojo) {
        String userDept = "";
        return userDept;
    }

    /**
     * 获取当前登录用户的权限部门
     *
     * @param backendUserPojo 当前登录用户信息
     * @return 当前登录用户的权限部门
     */
    public String getUserDeptWithChild(BackendUserPojo backendUserPojo) {
        String userDept = "";
        return userDept;
    }

    /**
     * 获取当前时间
     *
     * @param backendUserPojo
     * @return
     */
    public String getNow(BackendUserPojo backendUserPojo) {
        String nowString = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

        return nowString;
    }

    /**
     * 获取当天
     *
     * @param backendUserPojo
     * @return
     */
    public String getToday(BackendUserPojo backendUserPojo) {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.MILLISECOND, 0);

        String todayString = sdf1.format(cal.getTime());

        return todayString;
    }


    /**
     * 获取当前用户所属部门的用户id字符串--不包含子部门
     *
     * @param backendUserPojo
     * @return
     */
    public String getUserDepartmentUserIdList(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }

    /**
     * 获取当前用户所属部门的用户id字符串--包含子部门
     *
     * @param backendUserPojo
     * @return
     */
    public String getUserDepartmentWithChildUserIdList(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }

    /**
     * 获取当前用户所属权限部门的用户id字符串--不包含子部门
     *
     * @param backendUserPojo
     * @return
     */
    public String getUserDeptUserIdList(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }

    /**
     * 获取当前用户所属权限部门的用户id字符串--包含子部门
     *
     * @param backendUserPojo
     * @return
     */
    public String getUserDeptWithChildUserIdList(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }

    /**
     * 采购内部对应关系
     *
     * @param backendUserPojo
     * @return
     */
    public String getPurchaserDpUserRelation(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }

    /**
     * 销售内部对应关系
     *
     * @param backendUserPojo
     * @return
     */
    public String getCrmUserRelationShip(BackendUserPojo backendUserPojo) {
        String returnResult = "-1";
        return returnResult;
    }
}
